package com.itcast.peft.controller;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.itcast.peft.service.EvaluateService;
import com.itcast.peft.service.HealthAccuracyEvaluateService;

@RestController
@RequestMapping("/eval")
public class EvalController {

    @Autowired
    private EvaluateService evaluateService;
    
    @Autowired
    private HealthAccuracyEvaluateService healthAccuracyEvaluateService;

    @GetMapping("/evaluate")
    @ResponseBody
    public String evaluate(@RequestParam("refGroup") String refGroup, @RequestParam("ansGroup") String ansGroup)
            throws IOException {
        evaluateService.evaluate(refGroup, ansGroup);
        return "success";
    }

    @GetMapping("/similarityEvaluate")
    @ResponseBody
    public String similarityEvaluate(@RequestParam("refGroup") String refGroup, @RequestParam("ansGroup") String ansGroup)
            throws IOException {
        evaluateService.similarityEvaluate(refGroup, ansGroup);
        return "success";
    }
    
    @GetMapping("/accuracyEvaluate")
    @ResponseBody
    public String accuracyEvaluate(@RequestParam("refGroup") String refGroup, @RequestParam("ansGroup") String ansGroup)
            throws IOException {
        healthAccuracyEvaluateService.accuracyEvaluate(refGroup, ansGroup);
        return "success";
    }
}
